package com.heima.ssm.dao;

import com.heima.ssm.pojo.Product;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author Penguin
 * @create Date 2021/4/30  Time 15:50
 */
public interface IProductDao {

    //查询所有产品
    @Select("select * from product")
    List<Product> findAll();

    //新增产品
    @Insert("insert into product(productNum,productName," +
            "cityName,departureTime,productPrice,productDesc,productStatus) " +
            "values(#{productNum},#{productName},#{cityName},#{departureTime}," +
            "#{productPrice},#{productDesc},#{productStatus})")
    void save(Product product);

    //IOrdersDao中联查用到的方法
    @Select("select * from product where id = #{productId}")
    Product findProductByProductIdFromOrders(int productId);
}
